home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-25 | 5.2 KB | 170 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWBmpShp.h
- // Release Version: $ ODF 1 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWBMPSHP_H
- #define FWBMPSHP_H
-
- #ifndef FWBNDSHP_H
- #include "FWBndShp.h"
- #endif
-
- #ifndef FWBITMAP_H
- #include "FWBitmap.h"
- #endif
-
- //========================================================================================
- // Forward Declarations
- //========================================================================================
-
- class FW_CGraphicContext;
-
- //========================================================================================
- // class FW_CBitmapShape
- //========================================================================================
-
- class FW_CBitmapShape : public FW_CBoundedShape
- {
- public:
- FW_DECLARE_CLASS
- FW_DECLARE_AUTO(FW_CBitmapShape)
-
- //----------------------------------------------------------------------------------------
- // Constructors/Destructors
- //
- public:
- FW_CBitmapShape(FW_CBitmap bitmap, const FW_CRect& dstRect);
- FW_CBitmapShape(FW_CBitmap bitmap, const FW_CRect& srcRect, const FW_CRect& dstRect);
-
- FW_CBitmapShape(const FW_CBitmapShape& other);
- FW_CBitmapShape(FW_CReadableStream& stream);
-
- virtual ~FW_CBitmapShape();
-
- //----------------------------------------------------------------------------------------
- // Operators
- //
- public:
- FW_CBitmapShape& operator=(const FW_CBitmapShape& other);
-
- //---------------------------------------------------------------------------------------
- // Inherited API
- //
- public:
- // ----- Rendering -----
- virtual void Render(FW_CGraphicContext& gc) const;
-
- // ----- Flatten -----
- virtual void Flatten(FW_CWritableStream& stream) const;
-
- //---------------------------------------------------------------------------------------
- // New API
- //
- public:
- // ----- Rendering -----
- static void RenderBitmap(FW_CGraphicContext& gc,
- FW_CBitmap bitmap,
- const FW_CRect& srcRect,
- const FW_CRect& dstRect,
- const FW_CInk& ink = FW_kNormalInk);
- static void RenderBitmap(FW_CGraphicContext& gc,
- FW_CBitmap bitmap,
- const FW_CRect& dstRect,
- const FW_CInk& ink = FW_kNormalInk);
-
- // ----- Copying -----
- virtual FW_CShape* Copy() const;
-
- // ----- Archiving -----
- static void* Read(FW_CReadableStream& stream, FW_ClassTypeConstant type);
-
- // ----- Geometry -----
- void SetGeometry(const FW_CBitmap& bitmap,
- const FW_CRect& srcRect,
- const FW_CRect& dstRect);
-
- void GetGeometry(FW_CBitmap& bitmap,
- FW_CRect& srcRect,
- FW_CRect& dstRect) const;
-
- void SetSourceRect(const FW_CRect& srcRect);
- void GetSourceRect(FW_CRect& srcRect) const;
-
- void SetDestinationRect(const FW_CRect& destinationRect);
- void GetDestinationRect(FW_CRect& destinationRect) const;
-
- FW_CBitmap GetBitmap() const;
- void SetBitmap(const FW_CBitmap& bitmap);
-
- //---------------------------------------------------------------------------------------
- // Data Members
- //
- private:
- FW_CRect fSrcRect;
- FW_CBitmap fBitmap;
- };
-
- //========================================================================================
- // Inlines
- //========================================================================================
-
- //---------------------------------------------------------------------------------------
- // FW_CBitmapShape::SetSourceRect
- //---------------------------------------------------------------------------------------
-
- inline void FW_CBitmapShape::SetSourceRect(const FW_CRect& srcRect)
- {
- fSrcRect = srcRect;
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CBitmapShape::GetSourceRect
- //---------------------------------------------------------------------------------------
-
- inline void FW_CBitmapShape::GetSourceRect(FW_CRect& srcRect) const
- {
- srcRect = fSrcRect;
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CBitmapShape::GetDestinationRect
- //---------------------------------------------------------------------------------------
- inline void FW_CBitmapShape::GetDestinationRect(FW_CRect& dstRect) const
- {
- dstRect = fRect;
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CBitmapShape::SetDestinationRect
- //---------------------------------------------------------------------------------------
-
- inline void FW_CBitmapShape::SetDestinationRect(const FW_CRect& dstRect)
- {
- fRect = dstRect;
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CBitmapShape::GetBitmap
- //---------------------------------------------------------------------------------------
-
- inline FW_CBitmap FW_CBitmapShape::GetBitmap() const
- {
- return fBitmap;
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CBitmapShape::SetBitmap
- //---------------------------------------------------------------------------------------
-
- inline void FW_CBitmapShape::SetBitmap(const FW_CBitmap& bitmap)
- {
- fBitmap = bitmap;
- }
-
- #endif
-